#ifndef _TWOGRE_COLOR_VARIABLE_H_
#define _TWOGRE_COLOR_VARIABLE_H_

#include "TwOgrePrerequisites.h"
#include "TwOgreVariable.h"

#include "OgreColourValue.h"
#include "OgreString.h"

namespace TwOgre{
	class Window;

    class ColorParams
    {
    public:
        ColorParams(const Ogre::String& name)
            : parent_(0)
            , name_(name)
            , label_(Ogre::StringUtil::BLANK)
            , group_(Ogre::StringUtil::BLANK)
            , help_(Ogre::StringUtil::BLANK)
            , shortcut_(Ogre::StringUtil::BLANK)
            , type_(TW_TYPE_COLOR4F)
            , readOnly_(false)
            , setCB_(NULL)
            , getCB_(NULL)
            , data_(NULL)
            , value_(Ogre::ColourValue::Black)
        {}
     
        ColorParams& label(const Ogre::String& varLabel)
        {
            label_ = varLabel;
            return *this;
        }
        ColorParams& group(const Ogre::String& varGroup)
        {
            group_ = varGroup;
            return *this;
        }
        ColorParams& help(const Ogre::String& varHelp)
        {
            help_ = varHelp;
            return *this;
        }
        ColorParams& shortcut(const Ogre::String& varShortcut)
        {
            shortcut_ = varShortcut;
            return *this;
        }
        ColorParams& readOnly(bool varReadOnly)
        {
            readOnly_ = varReadOnly;
            return *this;
        }
        ColorParams& callback(TwSetVarCallback setter, TwGetVarCallback getter, void* varData)
        {
            setCB_ = setter;
            getCB_ = getter;
            data_ = varData;
            return *this;
        }
        ColorParams& value(const Ogre::ColourValue& colourVal)
        {
            value_ = colourVal;
            return *this;
        }
    private:
		Window* parent_;
		Ogre::String name_;
        Ogre::String label_;
        Ogre::String group_;
        Ogre::String help_;
        Ogre::String shortcut_;
		TwType type_;
        bool readOnly_;
        TwSetVarCallback setCB_;
        TwGetVarCallback getCB_;
        void* data_;

        Ogre::ColourValue value_;
        
        friend class Window;
		friend class ColorVariable;		
    };
    
    class TwOgreExport ColorVariable : public Variable
	{
	protected:
		ColorVariable(Window *parent, const Ogre::String& name, bool readOnly, const Ogre::String& label, 
			const Ogre::ColourValue& color, const Ogre::String& groupName, const Ogre::String& help);
		ColorVariable(ColorParams& params);
		~ColorVariable();

	public:
		const Ogre::ColourValue& getColorValue() const;
		void setColorValue(const Ogre::ColourValue& color);

	private:
		mutable Ogre::ColourValue mColor;
		float mTweakColor[4];

		friend class Window;
	};
}; // End Namespace
#endif
